#!/bin/bash

# AI测试助手后端启动脚本

echo "🚀 启动AI测试助手后端服务..."

# 检查Python环境
if ! command -v python3 &> /dev/null; then
    echo "❌ Python3 未安装"
    exit 1
fi

# 检查依赖
echo "📦 检查依赖..."
pip install -r requirements.txt

# 设置环境变量
export PYTHONPATH=$PYTHONPATH:$(pwd)

# 启动服务
echo "🔧 启动FastAPI服务..."
uvicorn main:app \
    --host 0.0.0.0 \
    --port 8000 \
    --timeout-keep-alive 300 \
    --timeout-graceful-shutdown 30 \
    --limit-concurrency 1000 \
    --limit-max-requests 10000 \
    --workers 1 \
    --log-level info \
    --access-log

echo "✅ 服务启动完成！"
echo "📍 访问地址: http://localhost:8000"
echo "📚 API文档: http://localhost:8000/docs" 